#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#include <unistd.h>
#include "engine.h"
#include <iostream>
#include <sys/time.h>


using namespace std;



inline long long gettimeus()
{
    struct timeval tv;

    gettimeofday( &tv, NULL );
    return (long long) tv.tv_sec * 1000000LL + (long long) tv.tv_usec;
}

int main(int argc, char *argv[]) {
    //засекаем время
    #ifdef _OPENMP
    double start=omp_get_wtime();
    #else
        double start = gettimeus();
        printf("time=%d",gettimeus());
    #endif

    Engine *e;
    if (argc==7){
        e=new Engine(atoi(argv[1]),atoi(argv[2]),atoi(argv[3]),atoi(argv[4]),atoi(argv[5]),atoi(argv[6]),start);
    }
    else{
        e=new Engine(10,10,10,3,4,17,start);
    }
    //printf("num_procs = %d\n",omp_get_num_procs());
    e->printToScreen();

    e->solve1();
    delete (e);
    #ifdef _OPENMP
    double end = omp_get_wtime();
    printf("%.16g\n", (end - start));
#else
    double end= gettimeus();
    printf("%.16g\n", (end - start)/1000000);
    #endif



    return 0;
}
